package com.liao.seckill.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
public class Result<T> {

    private T data;
    private String msg;
    private Integer code;

    public Result(T data){
        this(data,ResultCode.SUCCESS);
    }

    public Result(ResultCode resultCode){
        this(null,resultCode);
    }

    public Result(T data, ResultCode resultCode){
        this.msg = resultCode.getMsg();
        this.code = resultCode.getCode();
        this.data = data;
    }
}
